#-*-encoding:utf-8 -*-
#特点：获取不到本地服务的pid
import psutil

x = psutil.net_connections(kind="all")

for session in x:
    if session.laddr and session.raddr:
        print(session)
        sip=session.laddr.ip                                            #源IP
        sport=session.laddr.port
        pid = session.pid
        # print(type(sport))
        if sport == 80:
            print(sip, sport, pid)